﻿@using WanFang.Test
@model List<Material>
@{
    Layout = "~/Views/Shared/_TestLayout.cshtml";
}
@section headSec{
    <link href="/Content/Hplus-v.4.1.0/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="/Content/treeview/css/bootstrap-treeview.css" rel="stylesheet">
    <script src="/Content/treeview/bootstrap-treeview.js"></script>
    <script src="/Content/BootstrapMenu/BootstrapMenu.min.js"></script>
    <script src="/Content/Hplus-v.4.1.0/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>

    <script>
        $(document).ready(function(){
            $("#personTb").bootstrapTable({
                search: true,
                pagination: true,
                showRefresh: true,
                showToggle: true,
                showColumns: true,
                iconSize: 'outline',
                toolbar: '#exampleTableEventsToolbar',
                clickToSelect: true,                //是否启用点击选中行
                onLoadSuccess: function (data) {
                    alert('load');
                    console.log(data);
                    //$('#personTb').bootstrapTable('load', data.result);
                },
                onLoadError: function (status) {
                    alert("error");
                    console.log(status);
                },
                icons: {
                    refresh: 'glyphicon-repeat',
                    toggle: 'glyphicon-list-alt',
                    columns: 'glyphicon-list'
                }
            });
        });
        function showDlg() {
            layer.open({
            type:2,
            title:'word导入',
            area:['700px','500px'],
            content:'/TestMaterial/Add'
        });
        }

        function formDesc() {
            var a = $("#personTb").bootstrapTable('getSelections');
            if (a.length != 1) {
                alert("请选中一行记录");
                return;
            }
            layer.open({
                type: 2,
                title: '表单设计',
                area: ['700px', '500px'],
                content: '/TestDynamicField/FormDesign/' + a[0].Id
            });
        }
        function addZhiJian() {
            var a = $("#personTb").bootstrapTable('getSelections');
            if (a.length != 1) {
                alert("请选中一行记录");
                return;
            }
            layer.open({
                type: 2,
                title: '质检单',
                area: ['700px', '500px'],
                content: '/TestDynamicField/Form/' + a[0].Id
            });
        }
    </script>
}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 id="pHead">物料：</h5>
                    <div class="ibox-tools">
                    </div>
                </div>
                <div class="ibox-content">
                    <p>
                        <button class="btn btn-success " type="button"><i class="fa fa-plus"></i>&nbsp;添加</button>
                        <button class="btn btn-success " type="button" onclick="showDlg()">
                            <i class="fa fa-upload"></i>&nbsp;&nbsp;<span class="bold">WORD导入</span>
                        </button>
                        <button class="btn btn-success " type="button" onclick="formDesc()"><i class="fa fa-plus"></i>&nbsp;表单设计</button>
                        <button class="btn btn-success " type="button" onclick="addZhiJian()"><i class="fa fa-plus"></i>&nbsp;新建质检单</button>
                    </p>
                    <table id="personTb" data-height="250" data-mobile-responsive="true">
                        <thead>
                            <tr>
                                <th data-checkbox="true"></th>
                                <th data-field="Id">ID</th>
                                <th data-field="Name">品名</th>
                                <th data-field="FNumber">物料代码</th>
                                <th data-field="Batch">产品批号</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach(var m in Model)
                            {
                            <tr>
                                <td></td>
                                <td>@m.Id</td>
                                <td>@m.Name</td>
                                <td>@m.FNumber</td>
                                <td>@m.Batch</td>
                            </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
